﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiGradientGenerator : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiGradientGenerator(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiGradientGenerator obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiGradientGenerator()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiGradientGenerator(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGiGradientGenerator() : this(GlobalsPINVOKE.new_OdGiGradientGenerator__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGiGradientGenerator(OdGiGradientGenerator other) : this(GlobalsPINVOKE.new_OdGiGradientGenerator__SWIG_1(OdGiGradientGenerator.getCPtr(other)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createColorArray(uint nColors)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createColorArray(this.swigCPtr, nColors);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createColorArrayFilled(uint color, uint nColors)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createColorArrayFilled(this.swigCPtr, color, nColors);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void copyGradient(OdUInt32Array other)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_copyGradient__SWIG_0(this.swigCPtr, OdUInt32Array.getCPtr(other));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void copyGradient(uint[] colors)
		{
			IntPtr intPtr = Helpers.MarshalPalette(colors);
			try
			{
				GlobalsPINVOKE.OdGiGradientGenerator_copyGradient__SWIG_1(this.swigCPtr, intPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
			finally
			{
				Marshal.FreeCoTaskMem(intPtr);
			}
		}

		public void createGradient(uint color1, uint color2, uint nColors, OdGiGradientGenerator.InterpolationType ipl)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_0(this.swigCPtr, color1, color2, nColors, (int)ipl);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint nColors)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_1(this.swigCPtr, color1, color2, nColors);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint nColors, OdGiGradientGenerator.InterpolationType ipl)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_2(this.swigCPtr, color1, color2, color3, nColors, (int)ipl);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint nColors)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_3(this.swigCPtr, color1, color2, color3, nColors);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint nColors, OdGiGradientGenerator.InterpolationType ipl1, OdGiGradientGenerator.InterpolationType ipl2)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_4(this.swigCPtr, color1, color2, color3, nColors, (int)ipl1, (int)ipl2);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint color4, uint nColors, OdGiGradientGenerator.InterpolationType ipl)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_5(this.swigCPtr, color1, color2, color3, color4, nColors, (int)ipl);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint color4, uint nColors)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_6(this.swigCPtr, color1, color2, color3, color4, nColors);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint color4, uint nColors, OdGiGradientGenerator.InterpolationType ipl1, OdGiGradientGenerator.InterpolationType ipl2, OdGiGradientGenerator.InterpolationType ipl3)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_7(this.swigCPtr, color1, color2, color3, color4, nColors, (int)ipl1, (int)ipl2, (int)ipl3);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint color4, uint color5, uint nColors, OdGiGradientGenerator.InterpolationType ipl)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_8(this.swigCPtr, color1, color2, color3, color4, color5, nColors, (int)ipl);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint color4, uint color5, uint nColors)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_9(this.swigCPtr, color1, color2, color3, color4, color5, nColors);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void createGradient(uint color1, uint color2, uint color3, uint color4, uint color5, uint nColors, OdGiGradientGenerator.InterpolationType ipl1, OdGiGradientGenerator.InterpolationType ipl2, OdGiGradientGenerator.InterpolationType ipl3, OdGiGradientGenerator.InterpolationType ipl4)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_createGradient__SWIG_10(this.swigCPtr, color1, color2, color3, color4, color5, nColors, (int)ipl1, (int)ipl2, (int)ipl3, (int)ipl4);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void fillInterval(uint color, double from, double to)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_fillInterval__SWIG_0(this.swigCPtr, color, from, to);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void fillInterval(uint color, double from)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_fillInterval__SWIG_1(this.swigCPtr, color, from);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void fillInterval(uint color)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_fillInterval__SWIG_2(this.swigCPtr, color);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void fillInterval(uint color, uint from, uint to)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_fillInterval__SWIG_3(this.swigCPtr, color, from, to);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void generateInterval(uint color1, uint color2, double from, double to, OdGiGradientGenerator.InterpolationType ipl)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_generateInterval__SWIG_0(this.swigCPtr, color1, color2, from, to, (int)ipl);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void generateInterval(uint color1, uint color2, double from, double to)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_generateInterval__SWIG_1(this.swigCPtr, color1, color2, from, to);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void generateInterval(uint color1, uint color2, double from)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_generateInterval__SWIG_2(this.swigCPtr, color1, color2, from);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void generateInterval(uint color1, uint color2)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_generateInterval__SWIG_3(this.swigCPtr, color1, color2);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void generateInterval(uint color1, uint color2, uint from, uint to, OdGiGradientGenerator.InterpolationType ipl)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_generateInterval__SWIG_4(this.swigCPtr, color1, color2, from, to, (int)ipl);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void generateInterval(uint color1, uint color2, uint from, uint to)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_generateInterval__SWIG_5(this.swigCPtr, color1, color2, from, to);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public uint colorsCount()
		{
			uint result = GlobalsPINVOKE.OdGiGradientGenerator_colorsCount(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public uint colorAt(uint nColor)
		{
			uint result = GlobalsPINVOKE.OdGiGradientGenerator_colorAt__SWIG_0(this.swigCPtr, nColor);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public uint colorAt(double at)
		{
			uint result = GlobalsPINVOKE.OdGiGradientGenerator_colorAt__SWIG_1(this.swigCPtr, at);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isInitialized()
		{
			bool result = GlobalsPINVOKE.OdGiGradientGenerator_isInitialized(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdUInt32Array asArray()
		{
			OdUInt32Array result = new OdUInt32Array(GlobalsPINVOKE.OdGiGradientGenerator_asArray(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setAddressMode(OdGiGradientGenerator.AddressMode mode)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_setAddressMode(this.swigCPtr, (int)mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGiGradientGenerator.AddressMode addressMode()
		{
			OdGiGradientGenerator.AddressMode result = (OdGiGradientGenerator.AddressMode)GlobalsPINVOKE.OdGiGradientGenerator_addressMode(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static uint interpolateColor(uint color1, uint color2, double at, OdGiGradientGenerator.InterpolationType ipl, OdGiGradientGenerator.AddressMode mode)
		{
			uint result = GlobalsPINVOKE.OdGiGradientGenerator_interpolateColor__SWIG_0(color1, color2, at, (int)ipl, (int)mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static uint interpolateColor(uint color1, uint color2, double at, OdGiGradientGenerator.InterpolationType ipl)
		{
			uint result = GlobalsPINVOKE.OdGiGradientGenerator_interpolateColor__SWIG_1(color1, color2, at, (int)ipl);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static uint interpolateColor(uint color1, uint color2, double at)
		{
			uint result = GlobalsPINVOKE.OdGiGradientGenerator_interpolateColor__SWIG_2(color1, color2, at);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiGradientGenerator Assign(OdGiGradientGenerator other)
		{
			OdGiGradientGenerator result = new OdGiGradientGenerator(GlobalsPINVOKE.OdGiGradientGenerator_Assign(this.swigCPtr, OdGiGradientGenerator.getCPtr(other)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiGradientGenerator createSpectrumGradient(uint nColors)
		{
			OdGiGradientGenerator result = new OdGiGradientGenerator(GlobalsPINVOKE.OdGiGradientGenerator_createSpectrumGradient(nColors), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void appendGradient(OdGiGradientGenerator other)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_appendGradient(this.swigCPtr, OdGiGradientGenerator.getCPtr(other));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void Add(OdGiGradientGenerator other)
		{
			GlobalsPINVOKE.OdGiGradientGenerator_Add(this.swigCPtr, OdGiGradientGenerator.getCPtr(other));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;

		public enum InterpolationType
		{
			kLinearInterpolation,
			kExpInterpolation,
			kInvExpInterpolation,
			kCosInterpolation
		}

		public enum AddressMode
		{
			kClampMode,
			kWrapMode
		}
	}
}
